import matplotlib.pyplot as plt
import matplotlib.image as mpimg
from os.path import join,dirname


name="2024-03-23-20-07-09-208404.png"

DIR = dirname(__file__)

path=join(DIR, "gray_scale_188_120", name)

img=mpimg.imread(path)

threshold=0.5

# j行i列
for i in range (0,188):
    for j in range (0,120):
        # img[j][i]=120
        if img[j][i]>threshold:
            img[j][i]=1
        else:
            img[j][i]=0



plt.imshow(img,cmap='gray')
plt.show()


